<?php

namespace app\ports\controller\publics;

use think\Db;

/**
 * 机具绑定
 */
class Binds
{

	
	/**
	 * 对象实例
	 * @var object
	 */
	protected static $instance;

	/**
	 * 获取实例对象
	 * @return Binds|object
	 */
	public static function instance()
	{
		if (is_null(self::$instance)) {
			self::$instance = new static();
		}
		return self::$instance;
	}

	/**
	 * sn 绑定信息
	 * @return array|boolean
	 */
	public function _sn_binds_info($sn)
	{
		if (!empty($sn)) {
			$finds = Db::name("equip")
				->where("sn = '{$sn}' and status = 1")
				->field("top_id comid,main_id agid,product_id proid,binding_time bindTime")
				->find();
			if ($finds) return $finds;
		}
		return false;
	}
}
